package com.ysd.lis.controller.lab;


import com.ysd.common.Result;
import com.ysd.lis.annotation.LogDetail;
import com.ysd.lis.aspect.OperationType;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.lab.LabReqState;
import com.ysd.lis.request.DeleteParam;
import com.ysd.lis.service.lab.LabReqStateService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * LAB_REQ_MAIN状态表 前端控制器
 * </p>
 *
 * @author Bai
 * @since 2024-01-16
 */
@RestController
@RequestMapping("/lab/reqState")
public class LabReqStateController extends BaseController {

    @Autowired
    private LabReqStateService bacReqStateService;


    @ApiOperation("获取状态信息列表")
    @GetMapping("/findReqStateList")
    public Result findReqStateList() {
        return   Result.succ(bacReqStateService.list())   ;
    }

    @ApiOperation("根据状态id获取状态信息")
    @GetMapping("/findReqStateById/{id}")
    public Result findReqStateById(@PathVariable("id") String id) {
        return Result.succ( bacReqStateService.getById(id)) ;
    }

    @ApiOperation("添加状态")
    @PostMapping("/addReqState")
    @LogDetail(requestParam = "addReqState", operationType = OperationType.INSERT, module = "检验系统", content = "新增【stateValue】状态", businessName = "stateValue")
    public Result addReqState(@RequestBody LabReqState bacReqState) {
        return Result.succ(bacReqStateService.save(bacReqState));
    }

    @ApiOperation("编辑状态")
    @PostMapping("/edit")
    @LogDetail(requestParam = "edit", operationType = OperationType.UPDATE, module = "检验系统", content = "修改【stateValue】状态", businessName = "stateValue")
    public Result edit(@RequestBody LabReqState bacReqState) {
        return Result.succ(bacReqStateService.updateById(bacReqState)) ;
    }

    @ApiOperation("根据ids批量删除状态")
    @PostMapping("/deleteReqState")
    @LogDetail(requestParam = "deleteReqState", operationType = OperationType.DELETE, module = "检验系统", content = "删除【names】抗生素", businessName = "names")
    public Result deleteReqState(@RequestBody DeleteParam deleteParam) {
        return bacReqStateService.deleteReqState(deleteParam);
    }


}
